var req;
        
        // Get an XMLHttpRequest object in a portable way.
           function newRequest()
              {
                 req = false;               
                 // For Safari, Firefox, and other non-MS browsers
                 if (window.XMLHttpRequest) {
                    try {
                        req = new XMLHttpRequest();
                    } catch (e) {
                        req = false;
                    }
                 } else if (window.ActiveXObject) {                // For Internet Explorer on Windows
                        try {
                            req = new ActiveXObject("Msxml2.XMLHTTP");
                        } catch (e) {
                            try {
                                req = new ActiveXObject("Microsoft.XMLHTTP");
                            } catch (e) {
                                req = false;
                            }
                        } 
                  }
              }
        
        function chatCheck(){
              // Do this again in 5 seconds
              setTimeout('poll()', 5000);
              if (req) {
                alert("stop")
              // A request is in progress,
              // so don't make another one
              } else {
                newRequest()
                req.open("GET","http://localhost:8080/Game-war/checkservlet",false);
                req.send(null)
                if (req.status != 200) {
                    return;
                } else {
                window.location.reload()
                }
              // Start a new asynchronous request
               }     
        }
        
        function loginCheck(){
              // Do this again in 5 seconds
              //setTimeout('poll()', 5000);
              if (req) {
                alert("stop")
              // A request is in progress,
              // so don't make another one
              } else {
                newRequest()
                req.open("GET","http://localhost:8080/Game-war/loginservlet",false);
                req.send(null)
                if (req.status == 203) {
                    //TODO ajax for the login form
                } else if( req.status == 200 ) {
                    
                }
              // Start a new asynchronous request
               }     
        }
        
        function pollStateChange()
                {
                    if (req.readyState != 4) {
                    // We're not ready yet.
                    return;
                }
                    if (req.status == 200) {
                    if (req.responseXML) {
                    // The good stuff happens here!
                    }
                } else {
                // The web server gave us an error
                }
                req = null;
                }